package com.gis.halodepok;

import android.app.ListActivity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class Taxi extends ListActivity {



	


	@Override
	 protected void onCreate(Bundle savedInstanceState) {
	  super.onCreate(savedInstanceState);
	  String[] values = new String[] {"Blue Bird Taxi","Dian Taxi","Express Taxi","TransCAB","Taxiku Taxi"};
	  setContentView(R.layout.listmenu);
	  ArrayAdapter adapter = new ArrayAdapter(Taxi.this,android.R.layout.simple_list_item_1, values);
		setListAdapter(adapter);
	 
	 
	 }

	
	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		// TODO Auto-generated method stub
		super.onListItemClick(l, v, position, id);
		
		Object bank = this.getListAdapter().getItem(position);
		String pilihan = bank.toString();
		tampilkanBank (pilihan);
	}
	
	protected void tampilkanBank (String pilihan) {
		try {
		 Intent i = null;
		 if (pilihan.equals("Blue Bird Taxi")) {
			 String number = "0217941234";
			    Intent intent=new Intent (Intent.ACTION_DIAL,Uri.parse("tel:"+number));
				startActivity(intent);
		 }
		 else if (pilihan.equals("Dian Taxi")) {
			 String number = "0215807070";
			    Intent intent=new Intent (Intent.ACTION_DIAL,Uri.parse("tel:"+number));
				startActivity(intent);
		 }
		 else if (pilihan.equals("Express Taxi")) {
			 String number = "021-500122";
			    Intent intent=new Intent (Intent.ACTION_DIAL,Uri.parse("tel:"+number));
				startActivity(intent);
		 }
		 else if (pilihan.equals("TransCAB")) {
			 String number = "0217981001";
			    Intent intent=new Intent (Intent.ACTION_DIAL,Uri.parse("tel:"+number));
				startActivity(intent);
		 }
		 else if (pilihan.equals("Taxiku Taxi")) {
			 String number = "87913333";
			    Intent intent=new Intent (Intent.ACTION_DIAL,Uri.parse("tel:"+number));
				startActivity(intent);
		 }
		 
		 startActivity (i); 
		}
		
		catch (Exception e) {
		e.printStackTrace();	
		}
		 
			
	}



	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
